/*
 * @Description: 详情配置项
 * @Author: HuiSir<https://gitee.com/huisir001>
 * @Date: 2025-08-01 11:39:07
 * @LastEditTime: 2025-09-29 11:48:03
 */
import { defineDetailOptions } from "@/components/TablePage/predefined";
import { SexOpt } from "@/helpers/selection";

export default defineDetailOptions(() => [
  {
    label: "用户id",
    key: "id",
  },
  {
    label: "账号",
    key: "username",
  },
  {
    label: "昵称",
    key: "name",
  },
  {
    label: "性别",
    key: "sex",
    formatter: (params) => {
      return params.sex ? SexOpt.getLabel(params.sex as Sex) : "/";
    },
  },
  {
    label: "邮箱",
    key: "email",
  },
  {
    label: "手机号",
    key: "phone",
  },
  {
    label: "状态",
    key: "status",
    formatter: (params) => {
      const statusArr = ["冻结", "正常"];
      return statusArr[params.status as number];
    },
  },
  {
    label: "角色",
    key: "roles",
    formatter: (params: Record<string, unknown>) =>
      (params.roles as Role[]).map((role) => role.name).join(","),
  },
  {
    label: "部门",
    key: "dept",
    formatter: (params: Record<string, unknown>) => (params.dept as Dept).name,
  },
  {
    label: "IP地址",
    key: "ip",
  },
  {
    label: "登录地点",
    key: "location",
  },
  {
    label: "操作系统",
    key: "os",
  },
  {
    label: "浏览器",
    key: "browser",
  },
  {
    label: "登录时间",
    key: "loginTime",
  },
]);
